<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:75:"/Users/yandian/work/matian/application/admin/view/bootstrap/menu/index.html";i:1488938284;}*/ ?>
<link href="/css/plugins/jsTree/style.min.css" rel="stylesheet">
<script src="/js/plugins/jsTree/jstree.min.js"></script>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>系统菜单</h2>
        <ol class="breadcrumb">
            <li>
                <a href="#">首页</a>
            </li>

            <li class="active">
                <strong>系统菜单</strong>
            </li>
        </ol>
    </div>
</div>

<div class="wrapper wrapper-content animated fadeInRight ecommerce">
    <div class="row">
        <div class="col-sm-3">
            <div id="using_json"></div>
        </div>
        <div class="col-sm-9">
            <div class="ibox-content m-b-sm border-bottom" id="form1">
                <div class="row">
                    <div class="col-sm-6">
                        <a class="btn btn-success btn-outline" href="#<?php echo U('form'); ?>">
                            <i class="fa fa-edit"></i>
                            <span class="bold">添加</span>
                        </a>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox">
                        <div class="ibox-content">
                            <table class="footable table table-stripped toggle-arrow-tiny" id="footable">
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        var table = YFootTable.create('#footable', {
            baseUrl: "<?php echo U('menu/'); ?>",
            searchForm: '#form1',
            columns: [
                {name: 'title', title: '标题', sortable: true, breakpoints: 'xs ms'}
                , {name: 'url', title: '链接地址', sortable: true, breakpoints: 'xs ms'}
                , {name: 'parent_title', title: '父菜单', sortable: true, breakpoints: 'xs ms'}
                , {name: 'yn__is_valid', title: '是否有效', sortable: true, breakpoints: 'xs ms'}
                , {name: 'modify_time', title: '修改时间', sortable: true, breakpoints: 'lg'}
                , {name: 'modifier', title: '修改人', sortable: true, breakpoints: 'lg'}
                , {name: 'sort', title: '排序号', sortable: true, breakpoints: 'lg'}
                , {name: 'create_time', title: '创建时间', sortable: true, breakpoints: 'lg'}
                , {name: 'creator', title: '创建人', sortable: true, breakpoints: 'lg'}
            ],
            actions: ['view', 'edit', 'remove']
        }).on('remove', function () {
            $('#using_json').jstree('refresh');
        });

        $('#using_json').jstree({
            'core': {
                'data': {
                    url: "<?php echo U('menu/getMenusByPId',array('root'=>1)); ?>"
                }
            }
        }).on('select_node.jstree', function (e, data) {
            var node = data.node;
            var id = node.id;
            table.addPostParam('pid', id).loadData();
        });

    });
</script>